Refactor set-children function in children_hotkeys.py#782
Refactor set-children function in children_hotkeys.py#782eureka928 wants to merge 12 commits intoopentensor:stagingfrom
set-children function in children_hotkeys.py#782Conversation
|
@thewhaleking would you review my updates for set_children as we discussed? |
|
Hi @ibraheem-abe would you review my test for |
7a6224a to
fb9b950
Compare
05617d2 to
61d90b9
Compare
|
@thewhaleking I fixed the conflict and this is ready for review |
thewhaleking
left a comment
There was a problem hiding this comment.
Overall lgtm, just need to know about this one thing.
bittensor_cli/cli.py
Outdated
| parent_hotkey: Optional[str] = typer.Option( | ||
| None, | ||
| "--parent-hotkey", | ||
| help="Parent hotkey SS58 to manage (defaults to the selected wallet hotkey).", | ||
| prompt=False, | ||
| ), |
There was a problem hiding this comment.
What's the difference here between --parent-hotkey and --wallet-hotkey?
There was a problem hiding this comment.
Good catch! You're right - --parent-hotkey is redundant with --wallet-hotkey.
The difference was:
--wallet-hotkey: Selects which hotkey file to load from the wallet (e.g., "default", "validator1")--parent-hotkey: An SS58 address to override which parent hotkey to manage
However, since the coldkey signing the transaction must own the hotkey being modified anyway, you can simply use --wallet-hotkey other_hotkey_name to select a different hotkey.
I've removed the --parent-hotkey option to simplify the interface.
705f88e to
c26405f
Compare
3e5bf51 to
2344dc6
Compare
|
@thewhaleking I am creating the new branch and put the PR in the morning |
Summary
Refactors
stake child setto be simpler and more consistent, adds a parent hotkey override in the CLI, and adds e2e coverage.Changes
set_childrenrefactor: Simplifiedbittensor_cli/src/commands/stake/children_hotkeys.py:set_children()into a single loop over target netuids (dict_outputkeyed by netuid).--parent-hotkeyto:btcli stake child setand plumbed it through tochildren_hotkeys.set_children(..., hotkey=...).set_childrento reject when (\sum proportions > 1.0) (prints an error; when--json-outputis set, returns a JSON error payload).set_childrentotests/e2e_tests/test_children_hotkeys.py:test_set_childrentest_set_children_multiple_proportionsBefore vs After
Before:
After:
netuidswith consistentdict_outputstructure.hotkeyparameter (CLI:--parent-hotkey) to manage children for a different parent hotkey SS58.Test Coverage
Added 7 comprehensive e2e tests in
tests/e2e_tests/test_children_hotkeys.py:stake child getTests:test_get_children_json_output- Tests getting children with--json-outputflag, verifies JSON structure and validates response formattest_get_children_non_json_output- Tests getting children without JSON flag, verifies table format outputstake child setTests:test_set_children_single_child- Tests setting a single child hotkey with 50% proportion, verifiescompletion_blockandset_blockin responsetest_set_children_multiple_proportions- Tests setting multiple children (Bob 30%, Charlie 40%) with different proportions, verifies both are set correctlyTest Commands Verified
Added e2e tests in
tests/e2e_tests/test_children_hotkeys.py:btcli stake child get --netuid <netuid>btcli stake child get --all-netuidsbtcli stake child set --children <address> --proportions <proportion> --netuid <netuid>btcli stake child setwith multiple children and proportionsFiles Changed
bittensor_cli/src/commands/stake/children_hotkeys.pybittensor_cli/cli.pytests/e2e_tests/test_children_hotkeys.pyContribution by Gittensor, learn more at https://gittensor.io/